package com.tbb.app.common.entity;

import com.tbb.app.base.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
 * @author LiuSenLin
 * @date 2020/1/16 16:43
 */
@Accessors(chain = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserInfo implements Serializable {

    /**
     * id
     */
    private String id;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 昵称
     */
    private String name;

    /**
     * 账号
     */
    private String account;

    /**
     * 地区
     */
    private String location;

    /**
     * 性别，0-男，1-女
     */
    private Integer gender;

    /**
     * 头像url
     */
    private String profileImg;

    /**
     * 背景图url
     */
    private String backgroundImg;

    /**
     * 个性签名
     */
    private String profileText;

    /**
     * 管理员，0-普通用户，1-管理员
     */
    private Boolean isAdmin;

    public UserInfo(User user) {
        this.id = user.getId();
        this.createTime = user.getCreateTime();
        this.updateTime = user.getUpdateTime();
        this.name = user.getName();
        this.account = user.getAccount();
        this.location = user.getLocation();
        this.gender = user.getGender();
        this.profileImg = user.getProfileImg();
        this.backgroundImg = user.getBackgroundImg();
        this.profileText = user.getProfileText();
        this.isAdmin = user.getIsAdmin();
    }
}
